package com.leruan.aasimp.dao.impl;

import java.util.List;

import org.hibernate.Session;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.leruan.aasimp.dao.CarMrOddDAO;
import com.leruan.aasimp.entity.CarMrOdd;

/**
 * 美容申请
 * 
 * @see com.leruan.aasimp.entity.CarMrOdd
 * @author MyEclipse Persistence Tools
 */

public class CarMrOddDAOImpl extends HibernateDaoSupport implements CarMrOddDAO{


	public void addApply(CarMrOdd mrOdd) {
		Session session = this.getSession();
		session.save(mrOdd);
	}

	@SuppressWarnings("unchecked")
	public List<CarMrOdd> getMrOddsByUn(String username) {
		Session session = this.getSession();
		String hql = "from  CarMrOdd c where c.personname=? and c.status<>'0'";
		return session.createQuery(hql).setString(0, username).list();
	}

	public CarMrOdd getMrOddsById(Long id) {
		Session session = this.getSession();
		String hql = "from  CarMrOdd c where c.oddId=?";
		return (CarMrOdd) session.createQuery(hql).setLong(0, id).uniqueResult();
	}

	public void update(CarMrOdd mrOdd) {
		Session session = this.getSession();
		session.update(mrOdd);
	}
	
}